package bsf.baseservice.businessmq.systemruntime;

import bsf.baseservice.businessmq.db.ConsumerBLL;
import bsf.baseservice.businessmq.model.tb_config_model;
import bsf.baseservice.businessmq.systemruntime.log.ErrorLogHelper;
import bsf.db.DbConn;

/**
 配置帮助类
 
*/
public class ConfigHelper
{
	/** 
	 RedisServer
	 
	*/
	public static String RedisServer = "";
	/** 
	 DebugMqpath
	 
	*/
	public static String DebugMqpath = "";
	/** 
	 LogDBConnectString
	 
	*/
	public static String LogDBConnectString = "";
	/** 
	 加载配置
	 
	 @param manageconnectstring
	*/
	public static void loadConfig(String manageconnectstring)
	{
		try
		{
			java.util.ArrayList<tb_config_model> configs = new java.util.ArrayList<tb_config_model>();
			try(DbConn c = DbConn.createConn(manageconnectstring))
			{
				configs = new ConsumerBLL().getConfig(c);
			}
			for (tb_config_model c : configs)
			{
				if (c.key.toLowerCase().equals(EnumSystemConfigKey.RedisServer.toString().toLowerCase()))
				{
					RedisServer = c.value;
				}
				else if (c.key.toLowerCase().equals(EnumSystemConfigKey.DebugMqpath.toString().toLowerCase()))
				{
					DebugMqpath = c.value;
				}
				else if (c.key.toLowerCase().equals(EnumSystemConfigKey.LogDBConnectString.toString().toLowerCase()))
				{
					LogDBConnectString = c.value;
				}

			}
		}
		catch (Exception exp)
		{
			ErrorLogHelper.writeLine(-1, "", "LoadConfig", "初始化系统配置表信息出错", exp);
		}
	}
}